﻿package Classes.Enemies.Aero
{
	import flash.events.Event;	
	import flash.display.Sprite;
	
	import Classes.Elements.*;
	import Classes.Utils.*;
	import Classes.Weapons.Rockets.*;
	import Classes.Weapons.*;
	import Classes.Weapons.Bullets.*;
	import Classes.Interface.*;
	
	public class Pirate extends Aircraft implements ILaunch{		
		private var numGuns:int = 2;
		public function Pirate():void{
			speed = 3;
			life = 70;
			hp = 70;
			execution = 30;
			fireable = true;
			weaponType = WeaponType.Penguin;
			score = UnitType.Pirate.score;
		}
		override protected function move():void{
			inc++;
			if(fireable){
				launch();
			}
			super.move();
		}
		
		public function launch():void{
			if(inc%weaponType.interval == 0){
				for(var i:int=0;i<numGuns;i++){
					var penguin:Penguin = new Penguin();
					penguin.aTargets = this.aTargets;
					penguin.sender = this;
					penguin.x = this.x + i*16 - 8;
					penguin.y = this.y;					
					penguin.dimension = dimension;
					aFriends.push(penguin);
					dimension.addChildAt(penguin,0);
				}
			}			
		}
	}
}